import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-06-06
 * Time: 22:42
 */
public class swapPairs {

    public static class ListNode {
        int val;
        ListNode next;
        ListNode(int x) {
            val = x;
            next = null;
        }
    }

    public static ListNode swapPairs(ListNode head){
        ListNode dummyHead = new ListNode(-1);
        dummyHead.next = head;
        ListNode cur = dummyHead;
        ListNode first = null;
        ListNode second = null;

        while(cur.next!=null && cur.next.next!=null){
            first = cur.next;
            second = cur.next.next;

            //交换
            first.next = second.next;
            second.next = first;
            cur.next = second;

            cur = first;
        }
        return dummyHead.next;
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        ListNode head1 = null, tail1 = null;
        for (int i = 0; i < n1; i++) {
            int val = sc.nextInt();
            ListNode newNode = new ListNode(val);
            if (head1 == null) {
                head1 = newNode;
                tail1 = newNode;
            } else {
                tail1.next = newNode;
                tail1 = newNode;
            }
        }
        ListNode forRes = swapPairs(head1);
        while(forRes!=null){
            System.out.print(forRes.val+" ");
            forRes = forRes.next;
        }

    }
}


